﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using System.IO;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;
using KPIS.GERP.GFMS.DAL;
using KPIS.GERP.GFMS.MODEL;

using KPIS.GERP.GFMS.APP.App_UI.Commons;

namespace KPIS.GERP.GFMS.APP.App_UI.Forms
{
    public partial class ESS_ProjectOperationQty : System.Web.UI.Page
    {
        Main main = new Main();
        IBLL_BGM_ProjectExpense pjexp = new B_BGM_ProjectExpense();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtBgmProjExpSeq.Text = Request.QueryString["Seq"];
                LoadDataQty();
                cmdOK.OnClientClick = string.Format("returnToParent('{0}', '{1}', '{2}', '{3}', '{4}')", txtTotalAmount.ClientID
                    , Request.QueryString["txtAmount"], Request.QueryString["txtExchangeRate"], Request.QueryString["txtBathAmount"], Request.QueryString["txGrpAmount"]);
            }
        }

        protected void SetSummary()
        {
            double dUnitPrice = (txtUnitPrice.Value == null ? 0 : txtUnitPrice.Value.Value);
            double dUnitQty = (txtUnitQty.Value == null ? 0 : txtUnitQty.Value.Value);

            txtTotalAmount.Value = dUnitPrice * dUnitQty;
        }

        protected void LoadDataQty()
        {
            M_BGM_ProjectExpense info = pjexp.GetInfo(txtBgmProjExpSeq.Text);

            lblIcmResItemName.Text = info.icm_res_item_name;
            lblTotalAmount.Text = main.ConvertNumberToString(info.total_amount);
            lblUnitPrice.Text = main.ConvertNumberToString(info.unit_price);
            lblUnitQty.Text = main.ConvertNumberToString(info.unit_qty);
        }
    }
}
